﻿jQuery(function () {
    jQuery("#location").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Location"
    });
    jQuery("#name").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Name"
    });
    jQuery("#email").validate({
        expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
        message: "Please enter a valid Email ID"
    });
    jQuery("#mobile").validate({
        expression: "if (VAL.match(/^[9][0-9]{9}$/)) return true; else return false;",
        message: "Should be a valid Mobile Number"
    });
    jQuery("#txtBox").validate({
        expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
        message: "Please enter a valid ID"
    });
    jQuery("#txtlocation").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Location"
    });
    jQuery("#txtusername").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Name"
    });
    jQuery("#txtemail").validate({
        expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
        message: "Please enter a valid Email ID"
    });
    jQuery("#txtmobile").validate({
        expression: "if (VAL.match(/^[9][0-9]{9}$/)) return true; else return false;",
        message: "Should be a valid Mobile Number"
    });
    jQuery("#fetID").validate({
        expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
        message: "Please enter a valid ID"
    });
    jQuery("#locName").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Name"
    });
    jQuery("#locAddress").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Address"
    });
    jQuery("#locCountry").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Country"
    });
    jQuery("#locState").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the State"
    });
    jQuery("#locCity").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the City"
    });
    jQuery("#txtSearchID").validate({
        expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
        message: "Please enter a valid ID"
    });
    jQuery("#txtLocationName").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Name"
    });
    jQuery("#txtLocationAddress").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Address"
    });
    jQuery("#txtLocationCountry").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Country"
    });
    jQuery("#txtLocationState").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the State"
    });
    jQuery("#txtLocationCity").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the City"
    });
    jQuery("#txtSearch").validate({
        expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
        message: "Please enter a valid ID"
    });
    jQuery("#txtPassword").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please enter the Current Password"
    });
    jQuery("#txtNewpassword").validate({
        expression: "if (VAL.length > 5 && VAL) return true; else return false;",
        message: "Please enter a valid Password"
    });
    jQuery("#c_pass").validate({
        expression: "if ((VAL == jQuery('#ValidPassword').val()) && VAL) return true; else return false;",
        message: "Confirm password field doesn't match the password field"
    });



    jQuery("#ValidNumber").validate({
        expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
        message: "Please enter a valid number"
    });
    jQuery("#ValidInteger").validate({
        expression: "if (VAL.match(/^[0-9]*$/) && VAL) return true; else return false;",
        message: "Please enter a valid integer"
    });
    jQuery("#ValidDate").validate({
        expression: "if (!isValidDate(parseInt(VAL.split('-')[2]), parseInt(VAL.split('-')[0]), parseInt(VAL.split('-')[1]))) return false; else return true;",
        message: "Please enter a valid Date"
    });
    jQuery("#ValidEmail").validate({
        expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
        message: "Please enter a valid Email ID"
    });
    jQuery("#ValidPassword").validate({
        expression: "if (VAL.length > 5 && VAL) return true; else return false;",
        message: "Please enter a valid Password"
    });
    jQuery("#ValidConfirmPassword").validate({
        expression: "if ((VAL == jQuery('#ValidPassword').val()) && VAL) return true; else return false;",
        message: "Confirm password field doesn't match the password field"
    });
    jQuery("#ValidSelection").validate({
        expression: "if (VAL != '0') return true; else return false;",
        message: "Please make a selection"
    });
    jQuery("#ValidMultiSelection").validate({
        expression: "if (VAL) return true; else return false;",
        message: "Please make a selection"
    });
    jQuery("#ValidRadio").validate({
        expression: "if (isChecked(SelfID)) return true; else return false;",
        message: "Please select a radio button"
    });
    jQuery("#ValidCheckbox").validate({
        expression: "if (isChecked(SelfID)) return true; else return false;",
        message: "Please check atleast one checkbox"
    });
    jQuery('.AdvancedForm').validated(function () {
        alert("Use this call to make AJAX submissions.");
    });
});